home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / PRGMMING / COMMA.ZIP / READ.ME < prev    next >
Encoding:
Text File  |  1994-12-06  |  3.2 KB  |  92 lines

  1. Files in this zip file:
  2. -----------------------
  3.  
  4.       READ.ME       this description file
  5.       COMMA.OBJ     MicroSoft FORTRAN 5.1 compiled object file
  6.       TESTCOMM.FOR  Test program to show how COMMA works
  7.       COMMA.MAK     Makefile to show how to compile & link TESTCOMM.FOR
  8.  
  9.  
  10. Description:
  11. ------------
  12.  
  13. COMMA is a FORTRAN character function that is used to embed commas,
  14. and other special print characters, into your printouts.  For example,
  15. the number 12345678.000000 could be printed as "12,345,678" (quotes
  16. would not appear) or as "$12,345,678.00" or as "12,345,678.0%".
  17. The number 0.00 could be printed as "0","0.00"," -","NA", or " " (blank).
  18.  
  19. How to Use:
  20. -----------
  21.  
  22. The following simple program shows how to use the COMMA function:
  23.  
  24.       DOUBLE PRECISION DX(3)
  25.       REAL X(3)
  26.       INTEGER N(3)
  27.       CHARACTER*20 COMMA                                         (1)
  28.       DX(1)=1234.33333
  29.       DX(2)=0.0
  30.       DX(3)=1.0
  31.       WRITE(*,100) (COMMA(DX(I),10,1,1,2),I=1,3)                 (2)
  32.       X(1)=1234.33333
  33.       X(2)=0.0
  34.       X(3)=1.0
  35.       WRITE(*,100) (COMMA(DBLE(X(I)),10,1,1,2),I=1,3)            (3)
  36.       N(1)=1234
  37.       N(2)=0
  38.       N(3)=1
  39.       WRITE(*,100) (COMMA(DBLE(N(I)),10,1,1,2),I=1,3)            (3)
  40. 100   FORMAT(1X,3A10)                                            (4)
  41.       STOP
  42.       END
  43.  
  44. Output from above program would be:
  45.    $1,234.3        NA      $1.0
  46.    $1,234.3        NA      $1.0
  47.    $1,234.0        NA      $1.0
  48.  
  49. (1)   In any routine (mainline, subroutine or function) that calls
  50.       COMMA, it must be defined as a CHARACTER*20 variable.
  51.  
  52. (2)   The arguments for COMMA are as follows:
  53.  
  54.       CHARACTER*20 FUNCTION COMMA(RRIN,LN,NDEC1,NP,NN1)
  55.  
  56.       RRIN:    NUMBER TO BE CONVERTED (DOUBLE PRECISION)
  57.       LN:      LENGTH OF THE OUTPUT FIELD (INTEGER)
  58.       NDEC1:    NUMBER OF DECIMAL PLACES TO BE DISPLAYED (INTEGER)
  59.       NP:      SPECIAL CHARACTER FLAG    (INTEGER)
  60.                 0 = NO SPECIAL CHARACTER
  61.                 1 = PREFIX OUTPUT STRING WITH DOLLAR SIGN ($)
  62.                 2 = SUFFIX OUTPUT STRING WITH PERCENT SIGN (%)
  63.       NN1:      ZERO FILL FLAG    (INTEGER)
  64.                 0 = PRINT ZEROS
  65.                 1 = CHANGE ZEROS TO A DASH (-)
  66.                 2 = CHANGE ZEROS TO NOT APPLICABLE (NA)
  67.                 3 = CHANGE ZEROS TO BLANKS
  68.  
  69. (3)   Real (single precision) and integers need to be converted
  70.       to double precision using the DBLE() intrinsic function.
  71.  
  72. (4)   The FORMAT statement requires character print fields of the
  73.       same length as specified in the call to COMMA.
  74.  
  75. THIS IS SHAREWARE!
  76. ------------------
  77.  
  78. If you intend to use this routine for any business purpose, please
  79. register by sending $10.00 to:
  80.  
  81. Peter Robertshaw
  82. 6430 Breezewood Ct.
  83. Orangevale, CA 95662
  84.  
  85. For your registration you will receive peace of mind, plus a disk with
  86. the FORTRAN code on it (or I will E-mail to code to your COMPUSERVE or
  87. INTERNET address).  This will allow you to use the routine with
  88. other FORTRAN compilers and on other platforms.  So far I have
  89. successfully used it on PC's (using MS FORTRAN and LAHEY FORTRAN),
  90. and on IBM mainframes, DEC VAX's, and UNIX based systems (SUN work-
  91. station and ALLIANT supercomputer).
  92.